home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / Utilities / Simple Help / stack_-1.xml < prev   
Encoding:
Extensible Markup Language  |  1994-03-29  |  8.3 KB  |  21 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>2</cardCount>
  7.     <cardID>2916</cardID>
  8.     <listID>2407</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>-- All of the routines in this stack are used to create and run a help system. This system is very
  17. -- simple to implement and reasonably quick depending on what options you allow.
  18. -- These scripts should be added to either the stack script or the home card. This way they
  19. -- will allways be available within any card.
  20. --
  21. -- NOTE: if you use any of these handlers anywhere else in your system then you should be sure
  22. --          that you use the "PASS" command to pass the handler on. Otherwise it will never reach
  23. --          here.
  24. --
  25. -- To use the system you must put the help information at the beginning of the script for a container
  26. -- whether it is a button or a field. Each "Paragraph" should start with "--" to indicate a comment
  27. -- line. The very last line of the help information should be "--EndOfHelp"
  28. -- To activate the help system hold the "OPTION" key down while moving the mouse into a container.
  29. -- The system will display all of the lines up to but not including the "--EndOfHelp" line in a card
  30. -- field called "Help". This implies that the card field must exist on each card that is processed.
  31. -- In order to work properly it must be the last card item created. Otherwise it will not appear
  32. -- on top of items where it is appropriate.
  33. -- The opencard handler does this. If you do not wish this to happen automatically then either
  34. -- delete or comment out the appropriate lines. You will then need to set up the Help field on the
  35. -- cards that you want it on. The field should be a scrolling field and have the locked text
  36. -- property set to true. This allows a mouseup within the field to be recognized.
  37. --
  38. -- HANDLER DESCRIPTIONS
  39. -- OpenCard
  40. -- The first thing OpenCard does is check to see if there is a Help card field. If there isn't
  41. -- then it creates one. This section should either be deleted or commented out if you do not
  42. -- want this feature. Eliminating it will speed up going from card to card.
  43. -- Next it sets the 5 global variables that are needed for the system to work properly
  44. -- CardH, CardV, HelpH, HelpV are the size of the card and help field. They are used to be sure
  45. -- that the field will display completely within the window of the card.
  46. -- If automatic creation of a helpfield is left in then the line "If there is a card field "Help"'
  47. -- can be eliminated along with its corresponding 'end if' statement.
  48. --
  49. -- CloseCard
  50. -- This has 2 functions that should not be done together since it would waste time.
  51. -- First, if the help field is there an it is visible then it will empty it and hide it. This is basically
  52. -- a reset.
  53. -- Second, the help field is deleted from the stack. If you decide to do this then you should
  54. -- comment out the first part.
  55. --
  56. -- MouseEnter
  57. -- This is the heart of the system.
  58. -- First, it checks to be sure the option key is down and there is a card field called "Help".
  59. -- If the field you ask for help on is the help field then nothing happens. This could be changed
  60. -- if you wished to provide help information about itsself.
  61. -- Second, it checks to be sure there is help information available first by checking for a script
  62. -- and then by making sure there was an end of help marker (see above). The information is then
  63. -- put into the help field.
  64. -- Third, it positions the help field so that it will normally be aligned with the top of the target
  65. -- and will appear to the right of the target. Checks are made to be sure that the entire help field
  66. -- will fit on the window. Its position is adjusted accordingly. First to the left of the target, then
  67. -- above the target and then just shoved over to fit.
  68. -- Last, the field is displayed and the HelpWaitTime is set to allow 5 seconds per line for the user
  69. -- to read the information.
  70. --
  71. -- MouseUp
  72. -- This is used to dismiss the help field if the user clicks in it.
  73. --
  74. -- MouseWithin
  75. -- This is used to prevent idle from dismissing the help field. As long as the user places the
  76. -- pointer within the help field then the field will never be dismissed.
  77. --
  78. -- idle
  79. -- If the help field is visible then it starts to time how long it has been visible. 5 seconds per line
  80. -- is allowed and then it will empty and hide the help field. If the mouse is kept within the
  81. -- help field then this will not happen.
  82.  
  83. on OpenCard
  84. global CardH,CardV,HelpH,HelpV,HelpWaitTime
  85. put the bottom of this card  -  the top of this card  into CardV
  86. put the right of this card  -  the left of this card into CardH
  87. -- This if-end if section should be commented out if you do not wish to have automatic
  88. -- creation of the card field "Help"
  89. if there is not a card field "Help" then
  90. lock screen
  91. domenu "New Field"
  92. choose browse tool
  93. set the name of the last card field  to "Help"
  94. set the style of card field "Help" to "Scrolling"
  95. set the textfont of card field "Help" to Geneva
  96. set the textsize of card field "Help" to 10
  97. set the rect of card field "Help" to 0,0,250,100
  98. set the locktext of card field "Help" to true
  99. Hide card field "Help"
  100. end if
  101. if there is a card field "Help" then
  102. put the bottom of card field "Help" - the top of card field "Help" into HelpV
  103. put the right of card field "Help" - the left of card field "Help" into HelpH
  104. end if
  105. pass opencard
  106. end OpenCard
  107.  
  108. on CloseCard
  109. global HelpWaitTime
  110. if there is a card field "Help" then
  111. put 0 into HelpWaitTime
  112. if visible of card field "Help" then
  113. hide card field "Help"
  114. put empty into card field "Help"
  115. end if
  116. --This next section is used to delete the card field "Help" when the card is closed
  117. --It is not required. If you decide to use it then the part of the opencard handler
  118. --that creates the field should be uncommented.
  119. put the lockscreen into LS
  120. lock screen
  121. show card field "Help"
  122. choose field tool
  123. click at loc of card field "Help"
  124. domenu "clear field"
  125. choose browse tool
  126. set the lockscreen to LS
  127. end if
  128. pass closecard
  129. end CloseCard
  130.  
  131. on MouseEnter
  132. Global CardH,CardV,HelpH,HelpV,HelpWaitTime
  133. if the optionkey is "Down" and there is a card field "Help" then
  134. if the name of the target is not "card field"&&quote&"Help"&quote then
  135. put the script of the target into junk
  136. if junk is not empty then
  137. put offset ("--EndOfHelp",junk) into s
  138. if s > 0 then
  139. lock screen
  140. put (the name of the target)&return&(char 1 to s-1 of junk) into card field "Help"
  141. set the textstyle of line 1 of card field "Help" to bold
  142. put the top of the target into t
  143. put the right of the target into r
  144. if r + helpH > cardH then set the right of card field "Help" to the left of the target
  145. else set the left of card field "Help" to r
  146. if t + HelpV > CardV then set the bottom of card field "Help" to the bottom of the target
  147. else set the top of card field "Help" to t
  148. if the top of card field "Help"<0 then set the top of card field "Help" to 0
  149. if the left of card field "Help"<0 then set the left of card field "Help" to 0
  150. if the right of card field "Help">CardH then set the right of card field "Help" to cardH
  151. if the bottom of card field "Help" > CardV then set the bottom of card field "Help" to cardV
  152. show card field "Help"
  153. put the seconds + (5 * the number of lines in card field "Help") into HelpWaitTime
  154. end if
  155. end if
  156. end if
  157. end if
  158. pass mouseenter
  159. end MouseEnter
  160.  
  161. On MouseUp
  162. if the name of the target is "card field"&&quote&"Help"&quote then hide card field "Help"
  163. pass MouseUp
  164. end MouseUp
  165.  
  166. On MouseWithin
  167. Global HelpWaitTime
  168. if there is a card field "Help" then
  169. if (visible of card field "Help") and (the mouseloc is within the rect of card field "Help") then put 0 into HelpWaitTime
  170. end if
  171. pass mousewithin
  172. end MouseWithin
  173.  
  174. on idle
  175. global HelpWaitTime
  176. if there is a card field "Help" then
  177. if the visible of card field "Help" then
  178. if HelpWaitTime is 0 then
  179. put the seconds + (5 * the number of lines in card field "Help") into HelpWaitTime
  180. else
  181. if the seconds >= HelpWaitTime then
  182. put empty into card field "Help"
  183. hide card field "Help"
  184. end if
  185. end if
  186. end if
  187. end if
  188. pass idle
  189. end idle
  190.  
  191. </script>
  192.     <background id="2812" file="background_2812.xml" name="" />
  193.     <card id="2916" file="card_2916.xml" marked="false" name="" owner="2812" />
  194.     <card id="2283" file="card_2283.xml" marked="false" name="" owner="2812" />
  195. </stack>
  196.